package cn.rocky.zuosheng;

/**
 * 反转链表
 */
public class CodeReverseList {

    public Node reverseList(Node head) {
        Node pre = null;
        Node next = null;
        while(head != null) {
            next = head.next;
            head.next = pre;
            pre = head;
            head = next;
        }
        return pre;
    }
}
